@echo off
@REM
@REM springfox补丁版部署脚本
@REM
@REM Copyright (c)2025, zhouxianli@outlook.com
@REM All rights reserved
@REM
@REM 此脚本的功能
@REM 部署springfox补丁版到本地私服
@REM

setlocal

set groupId=io.springfox
set version=3.0.0-patch-1
@REM 请在此文件中设定 repositoryId 和 url 参数 或通过命令参数传入,语法为: deploy_jar.bat [repositoryId] [url] 
::set repositoryId=
::set url=

if not "%1" == "" set "repositoryId=%1"
if not "%2" == "" set "url=%2"

if "%repositoryId%" == "" goto error_param
if "%url%" == "" goto error_param
goto ok_param

:error_param
echo 请通过命令参数传入,语法为: deploy_jar.bat [repositoryId] [url] 
goto end

:ok_param
call mvn deploy:deploy-file -Dfile="springfox-swagger2-%version%.jar" -DgroupId=%groupId% -DartifactId=springfox-swagger2 -Dversion=%version% -Dpackaging=jar -DrepositoryId=%repositoryId% -Durl=%url% >> deploy.log
call :validateResult %groupId%:springfox-swagger2:%version%

goto :end

:validateResult
    if %errorlevel% == 0 (
       echo INFO : Deploy %1 Succeed.
    ) else (
       echo ERROR: Deploy %1 Failed!
    )
goto:eof

endlocal
:end